package com.glacier.cloud.gateway.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * date 2024-01-31 20:18
 * 全局过滤器
 *
 * @author glacier
 * @version 1.0
 */
@Slf4j
public class LogFilter implements GlobalFilter {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        log.info("请求开始：{}，请求路径：{}", exchange.getRequest().getMethod().name(), exchange.getRequest().getURI());
        return chain.filter(exchange);
    }
}
